<template>
  <div>
    获取到参数是:{{my_name}}
  </div>
</template>

<script>
export default {
  name: "MyComponent2",
  props: {
    initParam: {
      type: Object,
      default: function() {
        return {};
      }
    }
  },
  data:function(){
    return {
      my_name: "组件二"
    }
  },
  mounted() {
    this.my_name = this.initParam.my_name
  },
  beforeDestroy() {
    this.$parent.$emit("clear_init_param");
  }
};
</script>

<style scoped>

</style>